<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Shop extends CI_Controller
{
    private $TB;
    private $token;
    private $tb_nick;
    private $data;

    function __construct()
    {
        parent::__construct();
        $this->load->library('Taobao/TopSdk');
        $this->TB = new TopClient;
        $this->TB->appkey = $this->config->item('tb_akey');
        $this->TB->secretKey = $this->config->item('tb_skey');
        $this->token = $this->session->userdata('token');
        $this->tb_nick = $this->session->userdata('tb_nick');
        $this->data['tb_is_login'] = $this->session->userdata('tb_is_login');
        $this->data['tb_nick'] = $this->session->userdata('tb_nick');
    }


    // 卖家店铺信息
    public function index()
    {
        if(!empty($this->data['tb_nick'])){
            $req = new ShopGetRequest;
            $req->setFields("sid,cid,title,nick,desc,bulletin,pic_path,created,modified");
            $req->setNick($this->data['tb_nick']);
            $result = _object_array($this->TB->execute($req));
            if(!empty($result['shop'])&&isset($result['shop']))
            {
                $this->data['info'] = $result['shop'];
                $this->load->view('shop/index',$this->data);
            }

        }
    }

}